<template>
  <div>
    <van-nav-bar :title="comment.reply_count?comment.reply_count+'条回复':'暂无回复'" left-arrow />
    <div class="scroll-wrap">
      <CommentItem :item='comment' />
      <van-cell title='全部回复' />
      <ArticleComment type='c' :articleId='comment.com_id' :list='Postlist' />
    </div>
    <div class="post-warp">
      <van-button round @click='isReplyComment  = true'>评论</van-button>
    </div>
    <van-popup v-model="isReplyComment" position="bottom">
      <CommentPost :target='comment.com_id' :art_id='$route.params.articleId' @onList='addList' />
    </van-popup>
  </div>
</template>

<script>
import CommentItem from '@/views/article/component/comment-item.vue'
import ArticleComment from '@/views/article/component/article-comment.vue'
import CommentPost from '@/components/comment-post.vue'
export default {
  components: { CommentItem, ArticleComment, CommentPost },
  props: ['comment'],
  name: 'PostComment',
  data () {
    return {
      Postlist: [],
      isReplyComment: false
    }
  },

  created () {
  },

  methods: {
    addList (e) {
      this.Postlist.unshift(e)
      this.isReplyComment = false
    }
  }
}
</script>

<style scoped lang='less'>
.scroll-wrap {
  position: fixed;
  top: 92px;
  bottom: 102px;
  width: 100%;
  overflow-y: scroll;
}
.post-warp {
  width: 100%;
  height: 100px;
  position: fixed;
  bottom: 0;
  border-top: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  .van-button {
    width: 640px;
    height: 80px;
    background-color: turquoise;
  }
}
</style>
